package Level02;

import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeMap;

public class Six {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请任意输入字符串");
        String nextLine = scanner.nextLine();
        char[] charArray = nextLine.toCharArray();
        TreeMap<Character, Integer> treeMap = new TreeMap<>();
        Set<Character> keySet = treeMap.keySet();
        //遍历字符数组
        for (char c : charArray) {
            treeMap.put(c, treeMap.getOrDefault(c, 0) + 1);
        }
        System.out.println(treeMap);
    }
}
